home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- main()
- {
- char *s = "hello there 12345.67089";
- char s1[6], s2[6], s3[6];
- int n1, n2, nargs;
- float f;
-
- nargs = sscanf(s,"%20s%3s%s%3d%5f%d",
- s1,s2,s3,&n1,&f,&n2);
- printf("%d: %s,%s,%s,%d,%f,%d\n",
- nargs,s1,s2,s3,n1,f,n2);
- return 0;
- }
-
- Output
- 6: hello,the,re,123,45.669998,89
-